﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="ProfileViewer.aspx.vb" Inherits="Assignment4.ProfileViewer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 91px;
        }
        .style3
        {
            width: 146px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Profile Viewer</h1>
    <table class="style1">
        <tr>
            <td class="style2" valign="top" rowspan="7">
                <asp:Image ID="imgAvatar" CssClass="gamepicture" runat="server" Height="116px" 
                    Width="118px" />
            </td>
            <td class="style3">
                <strong>Name</strong></td>
            <td>
                <asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style3">
                <strong>Surname</strong></td>
            <td>
                <asp:Label ID="lblSurname" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style3">
                <strong>Date of Birth</strong></td>
            <td>
                <asp:Label ID="lblBirth" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style3">
                <strong>Hobbies</strong></td>
            <td>
                <asp:Label ID="lblHobbies" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style3">
                <strong>Total Points Awarded</strong></td>
            <td>
                <asp:Label ID="lblTotalPoints" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style3">
                <strong>Average Time Taken For Picture Memory Games</strong></td>
            <td>
                <asp:Label ID="lblAverageTimeTaken" runat="server" Text="Label"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style3">
                &nbsp;</td>
            <td>
                <asp:Button ID="btnEditProfile" runat="server" style="height: 26px" 
                    Text="Edit My Profile" />
            </td>
        </tr>
    </table>
    <br />

    <h2>Points Awarded</h2>

    <asp:GridView ID="grvPointsAwarded" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4"  Width="596px">
        <Columns>
            <asp:BoundField DataField="RankingPointReason" HeaderText="Reason" 
                SortExpression="RankingPointReason" />
            <asp:BoundField DataField="RankingPointValue" 
                HeaderText="Points Per Reason" SortExpression="RankingPointValue" />
            <asp:BoundField DataField="TotalPoints" HeaderText="Points Awarded" 
                SortExpression="TotalPoints" />
        </Columns>
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
        <RowStyle BackColor="White" ForeColor="#003399" />
        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <SortedAscendingCellStyle BackColor="#EDF6F6" />
        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
        <SortedDescendingCellStyle BackColor="#D6DFDF" />
        <SortedDescendingHeaderStyle BackColor="#002876" />
    </asp:GridView>
    <br />

    <h2>Quizzes Tried</h2>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
        DataKeyNames="QuizScoreId" DataSourceID="SqlDataSourceQuizScores" 
        BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
        Width="568px">
        <Columns>
            <asp:TemplateField>  
              <ItemTemplate>
                <a href='<%#"QuizOverview.aspx?QuizId="+Eval("QuizId").ToString() %>'><img src='<%#getQuizImage(Eval("QuizId")) %>' class="gridpicture" alt="" /></a>
              
              </ItemTemplate>
            
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Quiz Title">
                <ItemTemplate>
                   
                    <asp:Label ID="lblQuizTitle" runat="server" Text='<%#getQuizTitle(Eval("QuizId")) %>'></asp:Label>

                </ItemTemplate> 
            
            </asp:TemplateField>
            <asp:BoundField DataField="QuizScoreScore" HeaderText="Score" 
                SortExpression="QuizScoreScore" DataFormatString="{0}/6" />
            <asp:BoundField DataField="QuizScoreAttemptDate" HeaderText="Attempt" 
                SortExpression="QuizScoreAttemptDate" />
            <asp:HyperLinkField DataNavigateUrlFields="QuizId" 
                DataNavigateUrlFormatString="QuizOverview.aspx?QuizId={0}" Text="Try Quiz" />
        </Columns>
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
        <RowStyle BackColor="White" ForeColor="#003399" />
        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <SortedAscendingCellStyle BackColor="#EDF6F6" />
        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
        <SortedDescendingCellStyle BackColor="#D6DFDF" />
        <SortedDescendingHeaderStyle BackColor="#002876" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceQuizScores" runat="server" 
        ConnectionString="<%$ ConnectionStrings:learningConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:learningConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [QuizesScores] WHERE ([UserId] = ?)">
        <SelectParameters>
            <asp:SessionParameter Name="UserId" SessionField="ProfileUserId" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />


</asp:Content>
